import { handleActions } from "redux-actions"
import { get_products_success } from "../actions/product"


const initState = {
  // 根据销量
  sold: [],
  // 根据创建时间
  createdAt: []
}
 const productReducer = handleActions({
  [get_products_success]: (state, action) =>({
    ...state,
    [action.payload.sortBy]: action.payload.products
  })
},initState)

export default productReducer
